<template>
  <div class="foodwesternFood">
    <western-header/>
    <western-logo/>
    <western-recommend :list="westernFoodRecommendList "/>
    <western-footer/>
  </div>
</template>

<script>
import WesternHeader from "./components/WesternHeader.vue";
import WesternLogo from "./components/WesternLogo.vue";
import WesternRecommend from "./components/WesternRecommend.vue";
import WesternFooter from "./components/WesternFooter.vue";
import axios from "axios";
export default {
  name: "foodwesternFood",
  components: {
    WesternHeader,
    WesternLogo,
    WesternRecommend,
    WesternFooter
  },
  data: function() {
    return {
      westernFoodRecommendList: []
    };
  },
  mounted() {
    this.getHomeApiInfo();
  },
  methods: {
    getHomeApiInfo() {
      axios
        .get("/mock/Food/westernFood.json")
        .then(this.getHomeResponseInfo, function(success) {
          console.log("请求json数据成功");
          console.log(success);
        })
        .catch(function(err) {
          console.log("请求json数据失败");
          console.log(err);
        });
    },
    getHomeResponseInfo(response) {
      console.log(response.data);
      let res = response.data;
      if (res.success && res.dataList) {
        const westernFoodData = res.dataList;
        this.westernFoodRecommendList = westernFoodData.WesternRecommedLists;
      }
    }
  }
};
</script>          